// +接口
// interface Student {
//   name: string
//   age: number
//   hobby: Array<string | number | boolean>
//   //   [propName: string]: any
// }
// function stu(student: Student) {
//   console.log(
//     `我的名字叫${student.name},我今年${
//       student.age
//     }岁啦,我喜欢${student.hobby.join()}~~`
//   )
// }
// 多传一个字段，这样写不报错
// let info = { name: 'qiq', age: 12, hobby: ['吃饭', '睡觉'], sex: '男' }
// stu(info)
// 多传一个字段，这样写报错（接口中没有[propName:string]:any的情况）
// stu({ name: 'qiq', age: 12, hobby: ['吃饭', '睡觉'], sex: '男' })
// 可用类型断言或[propName:string]:any避免错误
// stu({ name: 'qiq', age: 12, hobby: ['吃饭', '睡觉'], sex: '男' } as Student)
// 继承一个
// interface Square extends Shape {
//   sideLength: number
// }
// let square = {} as Square    //创建空对象，并断言为Square
// let square: Square = { sideLength: 0, color: '' } //创建包含两个属性的对象
// square.color = 'red'
// square.sideLength = 10
// let circle: Shape = { color: '' }
// circle.color = '123'
// console.log('square:', square)
// console.log('circle:', circle)
// 也可以继承多个接口
// interface Triangle extends Shape, Size {
//   sideLength: number
// }
// let triangle = {} as Triangle
// triangle.color = 'green'
// triangle.sideLength = 100
// triangle.size = 99
// console.log(triangle)
